<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon" href="../../../docs/src/assets/image2D.png">
    <script src="../../../build/image2D.js"></script>
    <title>image2D - 用例测试 - layer图层</title>
</head>

<body>
    <script>

        // 准备画布
        var canvas = $$('<canvas>非常抱歉，您的浏览器不支持canvas!</canvas>').attr({
            "width": 400,
            "height": 200
        }).appendTo('body');

        /**
         * 测试开始
         * ----------------------------
         */

        var layer = canvas.layer();
        var painter1 = layer.painter('painter1');
        var painter2 = layer.painter('painter2');

        painter1.config('fillStyle', 'red');
        painter2.config('fillStyle', 'blue');

        painter1.fillCircle(100, 100, 90);
        painter2.fillCircle(300, 100, 70);

        layer.update();

        // 下面来测试同名图层会不会重叠
        var p1 = layer.painter('p1');
        p1._a_ = '有了';
        var p2 = layer.painter('p1');
        var p3 = layer.painter('p3');
        if (p3._a_ != p1._a_ && p2._a_ == p1._a_) {
            console.log('图层画笔测试：通过');
        } else {
            console.error('图层画笔测试：失败');
        }

    </script>
</body>

</html>
